package com.example.controller;

import com.example.anno.Log;
import com.example.pojo.PageBean;
import com.example.pojo.Result;
import com.example.service.SourceService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/source")
public class SourceController {
    @Autowired
    private SourceService sourceService;
    @GetMapping
    public Result page(@RequestParam(defaultValue = "1") Integer page,
                       @RequestParam(defaultValue = "10") Integer pageSize) {
        log.info("分页查询,参数: {},{}", page, pageSize);
        PageBean pageBean = sourceService.page(page, pageSize);
        return Result.success(pageBean);
    }
    @Log
    @DeleteMapping("/{ids}")
    public Result delete(@PathVariable List<Integer> ids){
        log.info("根据id批量删除,id: {}", ids);
        sourceService.delete(ids);
        return Result.success();
    }
}

